using System.Data.SqlClient;

namespace DotConferenceSql
{
    /// <summary>
    /// Generic WHERE statement to filter a ID of a table
    /// </summary>
    public class IdWhereStatement : WhereStatementQueryElementBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="IdWhereStatement"/> class.
        /// </summary>
        /// <param name="id">The id.</param>
        public IdWhereStatement(int id)
            : base()
        {
            Parameters.Add(new SqlParameter("@id_where", id));
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="IdWhereStatement"/> class.
        /// </summary>
        /// <param name="id">The id.</param>
        public IdWhereStatement(short id)
            : base()
        {
            Parameters.Add(new SqlParameter("@id_where", id));
        }

        /// <summary>
        /// Generate the part of the query for this element.
        /// </summary>
        /// <returns>generated SQL fragment</returns>
        public override string BuildTextQuery()
        {
            return "id = @id_where";
        }
    }
}